package com.alibaba.citrus.cr.sales.plan.functions.contract;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;

import com.alibaba.citrus.cr.sales.plan.dto.api.request.contract.ContractImportRequest;
import com.alibaba.citrus.cr.sales.plan.model.enums.ContractStatDimensionEnum;
import com.alibaba.cz.base.tool.log.Log;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.lattice2.epoch.user.dto.LoginUser;
import com.alibaba.lattice2.epoch.user.service.EpochLoginUserService;
import com.epoch.app.bcorder.contracthandler.dto.ContractUrlUtilRequest;
import com.epoch.app.bcorder.contracthandler.dto.ContractUrlUtilResponse;
import com.epoch.app.bcorder.contracthandler.service.ContractHandlerService;
import com.epoch.app.bcorder.contractimporthis.dto.DeleteLimitSaveRequest;
import com.epoch.app.bcorder.contractimporthis.model.ContractImportHis;
import com.epoch.app.bcorder.contractimporthis.service.ContractImportHisService;
import com.epoch.app.bcorder.model.dto.ExcelImportCallBack;
import com.epoch.app.bcorder.model.dto.GetJobInfoRequest;
import com.epoch.app.bcorder.service.BcOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 说明
 *
 * @author jc
 * @since 1.0
 */
@Component
public class ContractHandler implements ContractHandlerService {



    @Override
    public ContractUrlUtilResponse contractUrlUtil(ContractUrlUtilRequest contractUrlUtilRequest) {
        Log log = Log.getLogger(ContractHandler.class);
        String name = "";
        String path = "";
        try {
             name = URLEncoder.encode(contractUrlUtilRequest.getName(), "UTF-8") ;
             path = URLEncoder.encode(contractUrlUtilRequest.getPath(), "UTF-8");
        } catch (Exception e) {
            log.info(e.getMessage());
        }
        String str = "/file/download?spm=epoch.applist.0.0.3461yUNWyUNWW7&path=" + path + "&name=" + name;
        return ContractUrlUtilResponse.builder().url(str).build();
    }
}
